package top.happylaishop.shop.spi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/spi")
public class SpiTest {

    @Autowired
    private Environment environment;

    /**
     *  例如 happylaishop.application.name
     * @param key
     * @return
     */
    @RequestMapping("/getEnv/{key}")
    public String getValueByKey(@PathVariable String key){
        return environment.getProperty(key);
    }
}
